package com.wxg.common.redis.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.integration.redis.util.RedisLockRegistry;

/**
 * Created by void on 2019/5/7.
 */
@Configuration
public class GlobalRedisLockConfiguration {

    /**
     * 默认60秒的过期时间
     * 重试机制，100毫秒进行重试一次
     * //TODO 重试几次？
     * @param redisConnectionFactory
     * @return
     */
    @Bean
    public RedisLockRegistry redisLockRegistry(RedisConnectionFactory redisConnectionFactory){
        return new RedisLockRegistry(redisConnectionFactory, "redisLock");
    }
}
